#include <iostream>
#include <stdio.h>

#include "../src/iterator_ex.h"

#include <algorithm>
#include <vector>
#include <functional>

using namespace std;



/// 
  template<typename _Tp>
    struct equal_to_1 : public unary_function<_Tp, bool>
    {
      bool operator()(const _Tp& __x) const
      {
	if( __x == 1 )
	  {return true;}
	else
	  return false;
      }
    };


int main()
{
    vector<int> vecInt1;
    vecInt1.push_back(1);
    vecInt1.push_back(2);
    vecInt1.push_back(3);
    vecInt1.push_back(4);
    vecInt1.push_back(5);

    vector<int> vecInt2;

    copy(vecInt1.begin(), vecInt1.end(), filter_back_inserter< vector<int>, equal_to_1<int> >(vecInt2) );

    vector<int>::iterator iter;
    for( iter = vecInt2.begin(); iter != vecInt2.end(); iter++ )
    {
        printf("%d\n", *iter);
    }

    getchar();
    return 0;
}
